﻿@model Metro.Kashikoi.Web.ViewModels.LocationRootModel
@{
    ViewBag.Title = "Root";
    Layout = "~/Views/Shared/LocationLayout.cshtml";
    ViewBag.TreeId = "root_" + Model.Organization.Id;
    ViewBag.Organization = Model.Organization;
}
<script src="~/Scripts/jquery-1.4.4.js" type="text/javascript"></script>
<div>
    <h4>
        @Model.Organization.Name</h4>
</div>
@Html.Partial("InventoryList", Model.Inventories)
@section RightBar
{
    <div>
        Organize
        <ul>
            <li><a href="#" id="rename">Rename </a></li>
            <li><a href="#" id="addFacility">Add Facility </a></li>
        </ul>
    </div>
    <div>
        Authorized users
        <ul>
            <li>@Html.ActionLink("Mac Lee", "Index", "Users")</li>
            <li>@Html.ActionLink("John Tian", "Index", "Users")</li>
        </ul>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#rename").click(function () {
                $("#dialog-rename").dialog("open");
            });
            $("#addFacility").click(function () {
                $("#dialog-addFacility").dialog("open");
            });

            $("#dialog-rename").dialog({
                autoOpen: false,
                modal: true,
                resizable: false
            });
            $("#dialog-addFacility").dialog({
                autoOpen: false,
                modal: true,
                resizable: false
            }
            );
        }
    )
 
    </script>
    <div id="dialog-rename" title="Rename">
        <form action="/Location/RenameRoot" method="post">
        <label for="name">
            Name</label><br />
        <input type="text" id="rootName" name="rootName"  value="@Model.Organization.Name"/>
        <input type="submit" value="OK" />
        </form>
    </div>
    <div id="dialog-addFacility" title="Add Facility">
        <form action="/Location/AddFacility" method="post">
        <label for="name">
            Name</label><br />
        <input type="text" id="facilityName" name="facilityName" value="NewFacility1" />
        <input type="submit" value="OK" />
        </form>
    </div>
}
